﻿@{
    // Views/Home/index.cshtml
    ViewBag.Title = "Index";
}
<h2>Index</h2>
<iframe src="@Url.Action("UploadFile", new { id = ViewBag.FileId })"></iframe>
<p id="progress"></p>
<script type="text/javascript">
    progress = 0;
    function checkForProgress() {
        $.ajax(
                    {
                        url: "@Url.Action("Status", "Home", new { id = ViewBag.FileId })",
                        success: function (returnvalue) {

                            if (returnvalue.isok) {
                                progress = returnvalue.message;
                                document.getElementById("progress").innerHTML = progress;
                                setTimeout(checkForProgress, 200);
                            } else {
                                // display error or something
                            }

                        }
                    });
    }

    setTimeout(checkForProgress, 1000);
</script>